<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>查看详情</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
     function check(){
	  var raop= $("input[name='options.id']:checked").val();
	  if(raop==null){
		  alert("请从列表中选择一项以完成投票！");
		  return false;
	  }
  		  return true;
      }
    </script>
</head>
<body>
	<h3 align="center">${olist[0].subject.title}</h3>
	<h3 align="center">${olist[0].subject.viewTimes}次查看，共有${olist[0].subject.totalVotes}人投票</h3>
	<form action="subject_vote.action" method="post"
		onsubmit="return check();">
		<input type="hidden" value="${olist[0].subject.id}" name="id">
		<table align="center" width="250px">
			<c:forEach var="item" items="${olist }">
				<tr>
					<td>${item.id }</td>
					<td><input type="radio" name="options.id" value="${item.id }" />${item.optContent
						}</td>
					<td>${item.vote}票</td>
					<td>${(item.vote)/olist[0].subject.totalVotes}%</td>
				</tr>
			</c:forEach>
			<tr>
				<td><input type="submit" value="我要投票" />
				</td>
				<td colspan="3"><a href="subject_list.action">返回首页</a>
				</td>
			</tr>
		</table>
	</form>

</body>
</html>
